TCSH

Section: User Commands (1)
Updated: 11 Feb 1989
Index Return to Main Contents
 

NAME

tcsh - C shell with file name completion and command line editing  

SYNOPSIS

tcsh [ -bcefinstvVxX ] [ argument ... ]  

DESCRIPTION

Tcsh is an enhanced version of the Berkeley UNIX C shell csh (1). It behaves exactly like the C shell, except for the added utilities of:


1) Command line editing using Emacs-style commands.


2) Visual step up/down through the history list.


3) Terminal mode sanity checking and resetting.


4) Interactive command, file name and user name completion.


5) File/directory/user list in the middle of a typed command.


6) Spelling correction of command, file, and user names.


7) Lookup of command documentation in the middle of a typed command.


8) History saved between logouts.


9) Automatic logout after long periods of idle time.


10) Automatic execution of a single command prior to printing each prompt.


11) Automatic periodic command execution.


12) A new syntax for the prompt, and the ability to set the prompt for "while" and "for" loops.


13) Time stamps in the history list.


14) An addition to the syntax of filenames to access entries in the directory stack.


15) The ability to watch for logins and logouts by user or terminal on the machine.


16) A scheduled event list, which specifies commands which are to be executed at given times.


17) A new builtin that does a subset of ls (1).


18) An addition to the file expression syntax for a character not in a set of characters.


19) New automatically initialized environment variables HOST and HOSTTYPE.


20) Commands for debugging terminal capabilities.


21) Searching for the visual history mechinism.


22) A new builtin for the which(1) command.


23) Restarting a stopped editor with two keystrokes.


24) Automatic execution of a command when the current working directory is changed.


25) Automatic execution of commands on an idle host.

For a description of standard C-shell features, see the csh manual page.

 

1. COMMAND LINE EDITING

Commands that the user types in may be edited using the same control characters that Gnu Emacs uses. Arrow and function key sequences are also allowed. Tcsh allows this by setting the terminal to `CBREAK' mode and reading the input one character at a time. The following is a list of which control characters do what.

EMACS functions

set-mark-command         ^@
beginning-of-line        ^A
backward-char            ^B
tty-sigintr              ^C
delete-char-or-list      ^D
end-of-line              ^E
forward-char             ^F
backward-delete-char     ^H
complete-word            ^I
newline                  ^J
kill-line                ^K
clear-screen             ^L
newline                  ^M
down-history             ^N
tty-flush-output         ^O
up-history               ^P
tty-start-output         ^Q
redisplay                ^R
tty-stop-output          ^S
transpose-chars          ^T
universal-argument       ^U
quoted-insert            ^V
kill-region              ^W
extended-key-prefix      ^X
yank                     ^Y
tty-sigtsusp             ^Z
prefix-meta              ^[
tty-sigquit              ^\
tty-dsusp                ^]
digit                    0 through 9
self-insert-command      A through Z
self-insert-command      a through z
self-insert-command      SPACE ! # $ % & " ' ` * + , - . / \
self-insert-command      : ; ( ) < > { } [ ] = ? @ ^ _ | ~
backward-delete-char     ^?
list-choices             M-^D
backward-delete-word     M-^H
complete-word            M-^I
clear-screen             M-^L
run-fg-editor            M-^Z
complete-word            M-^[
spell-word               M-$
digit-argument           M-0 through M-9
which-command            M-?
backward-word            M-B
capitalize-word          M-C
delete-word              M-D
forward-word             M-F
run-help                 M-H
downcase-word            M-L
history-search-forward   M-N
function-key-prefix      M-O
history-search-backward  M-P
spell-word               M-S
upcase-word              M-U
copy-region-as-kill      M-W
function-key-prefix      M-[
backward-word            M-b
capitalize-word          M-c
delete-word              M-d
forward-word             M-f
run-help                 M-h
downcase-word            M-l
history-search-forward   M-n
history-search-backward  M-p
spell-word               M-s
upcase-word              M-u
copy-region-as-kill      M-w
backward-delete-word     M-^?

EMACS Extended mode functions (^X)

exchange-point-and-mark  ^X

VI Insert Mode functions

tty-sigintr              ^C
list-or-eof              ^D
backward-delete-char     ^H
complete-word            ^I
newline                  ^J
kill-line                ^K
clear-screen             ^L
newline                  ^M
tty-flush-output         ^O
tty-start-output         ^Q
redisplay                ^R
tty-stop-output          ^S
backward-kill-line       ^U
quoted-insert            ^V
backward-delete-word     ^W
prefix-meta              ^X
tty-dsusp                ^Y
tty-sigtsusp             ^Z
vi-cmd-mode              ^[  (escape key)
tty-sigquit              ^\
backward-delete-char     ^?  (delete key)
self-insert-command      0 thru 9, A thru Z, a thru z
self-insert-command      SPACE ! # $ % & " ' ` * + , - . / \
self-insert-command      : ; ( ) < > { } [ ] = ? @ ^ _ | ~

VI Command Mode functions

beginning-of-line        ^A
tty-sigintr              ^C
list-choices             ^D
end-of-line              ^E
backward-delete-char     ^H
complete-word            ^I
newline                  ^J
kill-line                ^K
clear-screen             ^L
newline                  ^M
down-history             ^N
tty-flush-output         ^O
up-history               ^P
tty-start-output         ^Q
redisplay                ^R
tty-stop-output          ^S
backward-kill-line       ^U
backward-delete-word     ^W
prefix-meta              ^[
tty-sigquit              ^\
forward-char             SPACE
end-of-line              $
vi-zero                  0
digit-argument           1 through 9
which-command            ?
vi-add-at-eol            A
backward-word            B
vi-chg-to-eol            C
kill-line                D
vi-insert-at-bol         I
history-search-forward   J
history-search-backward  K
function-key-prefix      O
vi-replace-mode          R
vi-substitute-line       S
forward-word             W
backward-delete-char     X
function-key-prefix      [
beginning-of-line        ^
vi-add                   a
backward-word            b
delete-word              d
backward-char            h
vi-insert                i
down-history             j
up-history               k
forward-char             l
vi-replace-char          r
vi-substitute-char       s
vi-beginning-of-next-word w
delete-char              x
backward-delete-char     ^?   (delete key)
run-help                 M-?
function-key-prefix      M-O
function-key-prefix      M-[

Alphabetical list of function names

"backward-char"
"backward-delete-char"
"backward-delete-word"
"backward-kill-line"
"backward-word"
"beginning-of-line"
"capitalize-word"
"clear-screen"
"complete-word"
"copy-region-as-kill"
"delete-char"
"delete-char-or-list"
"delete-word"
"digit"
"digit-argument"
"down-history"
"downcase-word"
"end-of-file"
"end-of-line"
"exchange-point-and-mark"
"extended-key-prefix"
"forward-char"
"forward-word"
"function-key-prefix"
"gosmacs-transpose-chars"
"history-search-backward"
"history-search-forward"
"insert-last-word"
"keyboard-quit"
"kill-line"
"kill-region"
"kill-whole-line"
"list-choices"
"list-or-eof"
"newline"
"prefix-meta"
"quoted-insert"
"redisplay"
"run-fg-editor"
"run-help"
"self-insert-command"
"set-mark-command"
"spell-word"
"transpose-chars"
"tty-dsusp"
"tty-flush-output"
"tty-sigintr"
"tty-sigquit"
"tty-sigtsusp"
"tty-start-output"
"tty-stop-output"
"universal-argument"
"up-history"
"upcase-word"
"vi-beginning-of-next-word"
"vi-cmd-mode"
"vi-add"
"vi-add-at-eol"
"vi-insert"
"vi-insert-at-bol"
"vi-replace-char"
"vi-replace-mode"
"vi-substitute-char"
"vi-substitute-line"
"vi-zero"
"which-command"
"yank"

There is a new shell command, bind, that allows the user to redefine what any key does, or find out what any or all of the keys do.

If given two arguments bind binds the function (first argument) to the given key (second argument). The key may be: the direct character or a caret-<letter> combination, which is converted to control-<letter>; M-<letter> for an escaped character; or X-<string> for a function key. For the last of these, the function key prefix must be bound to the function "extended-key-prefix" and the string specified to the bind command must not include this prefix. By default (in both emacs and vi modes), "extended-key-prefix" is bound to M-[ and M-O (capital-oh) for the arrow keys and F1 through F20 function keys on ANSI terminals.

If given one argument bind takes the argument as the name for a key and tells what that key does.

If given no arguments bind tells what all of the keys do. If you give bind the single argument of 'defaults', it resets each key to its default value (see the above list).

 

2. VISUAL HISTORY

The keys ^P and ^N are used to step up and down the history list. If the user has typed in the following:

> ls
foo     bar
> echo mumble
mumble
>

then enters ^P, the shell will place "echo mumble" into the editing buffer, and will put the cursor at the end of the line. If another ^P is entered, then the editing line will change to "ls". More ^Ps will make the bell ring, since there are no more lines in the history. ^N works the same way, except it steps down (forward in time).

An easy way to re-do a command is to type ^P followed by Return. Also, pieces of previous commands can be assembled to make a new command. The commands that work on regions are especially useful for this.

^P and ^N actually only copy commands from out of the history into the edit buffer; thus the user may step back into the history and then edit things, but those changes do not affect what is actually in tcsh's history.

 

3. TTY MODE SANITY

As part of the editor, tcsh does a check and reset of the terminal mode bits. If the speed has been changed, then tcsh will change to using that speed. tcsh will also obey changes in the padding needed by the tty. Some changes to the command keys will be obeyed, however if a command key is unset, tcsh will reset it to what it was. Also, the shell will automatically turn off RAW and CBREAK modes, and will turn on the tty driver's output processing.

 

4. WORD COMPLETION

In typing commands, it is no longer necessary to type a complete name, only a unique abbreviation is necessary. When you type a TAB to tcsh it will complete the name for you, echoing the full name on the terminal (and entering it into the edit buffer). If the prefix you typed matches no name, the terminal bell is rung, unless the variable nobeep is set. The name may be partially completed if the prefix matches several longer names. If this is the case, the name is extended up to the point of ambiguity, and the bell is rung. This works for file names, command names, and the (csh) ~ user name convention. The variable fignore may be set to a list of suffixes to be disregarded during completion.

Example

Assume the current directory contained the files:

DSC.TXT bin     cmd     lib     memos
DSC.NEW chaos   cmtest  mail    netnews
bench   class   dev     mbox    new

The command:

> gnumacs ch[TAB]

would cause tcsh to complete the command with the file name chaos. If instead, the user had typed:

> gnumacs D[TAB]

tcsh would have extended the name to DSC and rung the terminal bell, indicating partial completion. However, if fignore had previously been set to a list containing .NEW as one element, e.g. ( .o .NEW ), tcsh would have completed the `D' to DSC.TXT.

File name completion works equally well when other directories are addressed. Additionally, tcsh understands the C shell tilde (~) convention for home directories. Thus,

> cd ~speech/data/fr[TAB]

does what one might expect. This may also be used to expand login names only. Thus,

> cd ~sy[TAB]

expands to

> cd ~synthesis

Command names may also be completed, for example,

> gnum[TAB]

will expand to "gnumacs" (assuming that there are no other commands that begin with "gnum").

Completion also works when the cursor is in the middle of the line, rather than just the end. All of the text after the cursor will be saved, the completion will work (possibly adding to the current name), and then the saved text will be restored in place, after the cursor.

 

5. LISTING OF POSSIBLE NAMES

At any point in typing a command, you may request "what names are available". Thus, when you have typed, perhaps:

> cd ~speech/data/fritz/

you may wish to know what files or subdirectories exist (in ~speech/data/fritz), without, of course, aborting the command you are typing. Typing the character Control-D (^D), will list the names (files, in this case) available. The files are listed in multicolumn format, sorted column-wise. Directories are indicated with a trailing `/', executable files with a `*', symbolic links with a '@', sockets with a '=', and FIFOs (named pipes) with a '<'. Once printed, the command is re-echoed for you to complete.

Additionally, one may want to know which files match a prefix. If the user had typed:

> cd ~speech/data/fr[^D]

all files and subdirectories whose prefix was ``fr'' would be printed. Notice that the example before was simply a degenerate case of this with a null trailing file name. (The null string is a prefix of all strings.) Notice also, that a trailing slash is required to pass to a new directory for both file name completion and listing.

The degenerate

> ~[^D]

will print a full list of login names on the current system.

The behavior of the completion can be changed by setting the shell variable recexact. This makes an exact command be expanded rather than just ringing the bell. For example, assume the current directory has two subdirectories called foo and food, then with recexact set the following could be done:

> cd fo[TAB]

to ...
> cd foo[TAB]

to ...
> cd foo/

rather than beeping on the second TAB.

For covert operation, the variable nobeep, can be set, preventing the completion mechanism from actually beeping.

 

Command Name Recognition

Command name recognition and completion works in the same manner as file name recognition and completion above. The current value of the environment variable PATH is used in searching for the command. For example

> newa[TAB]

might expand to

> newaliases

Also,

> new[^D]

would list all commands (along PATH) that begin with "new".

Note that Control-D has three different effects on tcsh. On an empty line (one that contains nothing, not even spaces), ^D sends an EOF to tcsh just as it does for normal programs. When the cursor is in the middle of a line of text, ^D deletes the character that the cursor is under. Finally, a ^D at the end of a line of text lists the available names at that point. To get a list of available names when the cursor is in the middle of a line (or on an empty line), a Meta-Control-D should be typed (Escape followed by Control-D).

 

6. SPELLING CORRECTION

If while typing a command, the user mistypes or misspells a file name, user name, or command name, tcsh can correct the spelling. When correcting a file name, each part of the path is individually checked and corrected. The key that invokes the corrector is Meta-$ (Escape Dollar-sign). For example, suppose that the user has typed:

> cd /uxr/spol/news[ESC $]

Tcsh will check the path for spelling, correct the mistakes, and redraw the line as

> cd /usr/spool/news

leaving the cursor at the end of the line. This, like the other commands that affect names, works for command names and user names also.

 

7. DOCUMENTATION LOOKUP

The editor function run-help (Meta-h) prints a help file on the current command (using the same definition of current as the completion routines use). This help file is found by searching the path list HPATH for files of the form foo.help, foo.1, foo.8, or foo.6 in that order (assuming that the current command is foo). The file is just printed, not paged in any way. This is because run-help is meant to be used to look up short help files, not manual pages (although it can do manual pages also).

 

8. HISTORY SAVING

Tcsh will save the history list between login sessions. It does this by writing the current list to the file "~/.history" on logout, and reading it in on login. For example, placing the line

set history=25 savehist=20

tells csh to save the last 25 commands on the history list, and to save the last 20 of them between logins. The "savehist" variable may be set up to the size of history, although it is an error to have savehist larger than history.

 

9. AUTOMATIC LOGOUT

The automatic logout time is controlled by the variable autologout, the value of which is the number of minutes of inactivity will be allowed before automatically logging the user out. When that many minutes have been reached, the shell prints "autologout" and dies (without executing ~/.logout). The default for tcsh is to set autologout for 60 minutes on login shells, and when the user is root. To disable autologout (for instance in a window system), unset the shell variable autologout. (NB: autologout is disabled by default on sprite.)

 

10. EXECUTION OF A COMMAND PRIOR TO EACH PROMPT

Tcsh supports a special alias, precmd, which if set holds a command that will be executed before printing each prompt. For example, if the user has done

> alias precmd date

then the program date will be run just before the shell prompts for each command. There are no limitations on what precmd can be set to do, although discretion should be used.

 

11. PERIODIC COMMAND EXECUTION

Tcsh is now capable of providing periodic command execution through the use of the shell variable tperiod and the alias periodic. When these items are set, the alias periodic will be executed every tperiod minutes. This provides a convenient means for checking on common but infrequent changes, such as new messages. Example:
> set tperiod = 30 > alias periodic checknews
This will cause the checknews(1) program to be run every 30 minutes. Having the alias periodic set but with an unset tperiod (or a value of 0 for tperiod) will cause periodic to degenerate to another form of precmd.

 

12. NEW PROMPT FORMAT

The format for the prompt shell variable has been changed to include many new things, such as the current time of day, current working directory, etc.. The new format uses "%<char>" to signal an expansion, much like printf(3S). The available sequences are:

%d or %/    Current working directory.
%~          cwd.  If it starts with $HOME, that part is replaced
            by a ~.
%c or %.    Trailing component of cwd.
%h, %!      Current history event number.
%M          The full machine hostname
%m          The hostname up to the first "."
%S (%s)     Start (stop) standout mode.
%t or %@    Current time of day, in 12-hour, am/pm format (but see
            the "ampm" shell variable below).
%T          Current time of day, in 24-hour format.
%%          A single %.

The sequences for standout are often used to indicate that this is an enabled (running as root) shell. An example:

> set prompt="%m [%h] %S[%@]%s [%/] you rang? "
tut [37] [2:54pm] [/usr/accts/sys] you rang? _

In addition, there is a new variable, prompt2, which is used to prompt for the body of while and for loops (wherever normal csh prompts with a question mark). The default for prompt2 is "\? ": a (quoted) question mark followed by a space.

 

13. TIME-STAMPED HISTORY LIST

The history list in this csh now has a time-of-day stamp attached to each history list event. This time stamp is printed whenever the history command is executed. This allows the user to keep track of when the various events occurred. The time stamps are not maintained on the saved history list (also available in tcsh); thus, on logging back in, all the saved history events will be recorded with the login time as their time stamp.

 

14. DIRECTORY STACK ELEMENT ACCESS

Tcsh will now allow the user to access all elements in the directory stack directly. The syntax "=<digit>" is recognized by tcsh as indicating a particular directory in the stack. (This works for the file/command name recognition as well.) This syntax is analogous to the ~ syntax for access to users' home directories. The stack is viewed as zero-based, i.e., =0 is the same as $cwd, which is the same as ".". As a special case, the string "=-" is recognized as indicating the last directory in the stack. Thus,
> dirs /usr/net/bin /usr/spool/uucp /usr/accts/sys > echo =2 /usr/accts/sys > ls -l =1/LOGFILE -rw-r--r-- 1 uucp 2594 Jan 19 09:09 /usr/spool/uucp/LOGFILE > echo =-/.cs* /usr/accts/sys/.cshrc > echo =4 Not that many dir stack entries. >
Tcsh will complain if you ask for a directory stack item which does not exist.

In the normal csh, saying "pushd +2" would rotate the entire stack around through 2 stack elements, placing the entry found there at the top of the stack. If, however, the new shell variable dextract is set, then issuing "pushd +n" will cause the nth directory stack element to be extracted from its current position, which will then be pushed onto the top of the stack. Example:

> dirs ~ /usr/spool/uucp /usr/net/bin /sys/src > set dextract > pushd +2 /usr/net/bin ~ /usr/spool/uucp /sys/src > unset dextract > pushd +2 /usr/spool/uucp /sys/src /usr/net/bin ~

 

15. WATCHING FOR LOGINS AND LOGOUTS

Tcsh has a mechanism so that the user can watch for login and logout activity of any user or terminal in the system. This is accomplished using the new special shell variable watch, which contains login/terminal name pairs to be checked for activity. For example:
> set watch=(sys ttyjd root console)
This setting will allow the user to check on when the user "sys" logs in on /dev/ttyjd. Similarly, it will inform the user of root's activity on the console. In order to be more general, the word "any" may be substituted for either a user's or a terminal's name, thus allowing
> set watch=(brad any any ttyh0)
which will check for user "brad" logging in or out of the system on any terminal, as well as anyone logging in to /dev/ttyh0. Naturally, the completely general case
> set watch=(any any)
allows the user to check on any and all login/logout activity in the the system.

By default, the interval between checks of users on the system is 10 minutes; this can be changed by making the first element of watch a number of minutes which should be used instead, as in

> set watch=(40 any any)
which will check for any users logging in or out every 40 minutes.

There is also a new command, log, which is used to cause csh to inform the user of all users/terminals affected by watch whether they have been announced before or not. This is useful if a user has been on for some time and cannot remember if a particular person/terminal is online right now or not. Log will reset all indication of previous announcement and give the user the login list all over again, as well as printing the current value of watch.

The first time that watch is set at csh startup, all affected users and terminals will be printed as though those users/terminals had just logged on. This may appear to be a bug, but is generally considered a feature, since it allows the user to see who is on when he first logs in.

 

16. TIMED EVENT LIST

Tcsh now supports a scheduled-event list through the use of the command sched. This command gives the user a mechanism by which to arrange for other commands to be executed at given times. An event is added to the scheduled-event list by saying
> sched [+]hh:mm <command>
as in
> sched 11:00 echo It\'s eleven o\'clock.
This will make an entry in the list at 11am for the echo command to be run with the given arguments. The time may be specified in either absolute or relative time, and absolute times may have a morning/afternoon specification as well, using "am" or "pm." For example,
> sched +2:15 /usr/lib/uucp/uucico -r1 -sother > sched 5pm set prompt='[%h] It\'s after 5; go home: >' > sched +3am echo This syntax doesn\'t work. Relative time inconsistent with am/pm. >
Note that tcsh will complain if you try to make faulty time specifications.

Printing the current time-event list is accomplished by giving the sched command with no arguments:

> sched 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother 2 Wed Apr 4 17:00 set prompt=[%h] It's after 5; go home: > >
There is also a mechanism by which the user can remove an item from the list:
> sched --3 Usage for delete: sched -<item#>. > sched -3 Not that many scheduled events. > sched -2 > sched 1 Wed Apr 4 15:42 /usr/lib/uucp/uucico -r1 -sother >
All commands specified on the scheduled-event list will be executed just prior to printing the first prompt immediately following the time when the command is to be run. Hence, it is possible to miss the exact time when the command is to be run, but tcsh will definitely get around to all commands which are overdue at its next prompt. Scheduled-event list items which come due while tcsh is waiting for user input will be executed immediately. In no case, however, will normal operation of already-running commands be interrupted so that a scheduled-event list element may be run.

This mechanism is similar to, but not the same as, the at(1) command on some Unix systems. Its major disadvantage is that it does not necessarily run a command at exactly the specified time (but only if another command is already being run). Its major advantage is that commands which run directly from the csh, as sched commands are, have access to shell variables and other structures. This provides a mechanism for changing one's working environment based on the time of day.

 

17. BUILTIN FOR ls -F

There is a new builtin command called ls-F which does the same thing as the command "ls -aF" if the shell variable showdots has been set, and acts like "ls -F" otherwise.

 

18. CHAR IN RANGE SYNTAX CHANGE

The syntax for any character in a range (for example ".[a-z]*") has been extended so as to conform with standard Unix regular expression syntax (see ed(1)). Specifically, after an open bracket ("["), if the first character is a caret ("^") then the character matched will be any not in the range specified. For example:

> cd ~ > echo .[a-z]* > echo .[^.]* >

Note that the second form includes .Xdefaults and .Xinit because 'X' (and all the lower case letters) are outside of the range of a single '.'.

 

19. NEW ENVIRONMENT AND SHELL VARIABLES

On startup, tcsh now automatically initializes the environment variable HOST to the name of the machine that it is running on. It does this by doing a gethostname(2) system call, and setting HOST to the result.

Tcsh also initializes the environment variable HOSTTYPE to a symbolic name for the type of computer that it is running on. The current possible values are:

alliant        an Alliant FX series
att3b2         an AT&T 3b2
att3b5         an AT&T 3b5
att3b15        an AT&T 3b15
att3b20        an AT&T 3b15
ballance       a Sequent Ballance (32000 based)
butterflyR     a BBN Computer Butterfly 1000
convex         a Convex
hp9000s300     an HP 9000, series 300 workstation
hp9000s800     an HP 9000, series 800 workstation
hp             an HP, but not an hp9000s800
multimax       an Encore Computer Corp. Multimax (32000 based)
mac2           an Apple Computer Macintosh II
pyramid        a Pyramid Technology computer (of any flavor)
rt             an IBM PC/RT running Mach
rtpc           an IBM PC/RT running IBM's BSD port
sun2           a Sun Microsystems series 2 workstation (68010 based)
sun3           a Sun Microsystems series 3 workstation (68020 based)
sun4           a Sun Microsystems series 4 workstation (SPARC based)
sun386i        a Sun Microsystems 386i workstation (386 based)
sun            a Sun workstation of none of the above types
symmetry       a Sequent Symmetry (386 based)
vax            a Digital Equipment Corp. Vax (of any flavor)

(The names of the machines are usually trade marks of the corresponding companies.) This is useful when sharing a single physical directory between several types of machines (running NFS, for instance). For example, if the following is in .login:

set path = (~/bin.$HOSTTYPE /usr/ucb /bin /usr/bin /usr/games .)

and the user has directories named "bin.machine" (where machine is a name from the above list), then the user can have the same programs compiled for different machines in the appropriate "bin.machine" directories and tcsh will run the binary for the correct machine.

Tcsh also initializes the shell variable uid to the value of the current real user ID. This is useful for telling what user the shell is running as.

 

20. COMMANDS FOR DEBUGGING

Only two such commands are available at this point, both concerned with testing termcap entries.
telltc tells you, politely, what tcsh thinks of your terminal, and settc `cap' `value' tells tcsh to believe that the termcap capability `cap' ( as defined in termcap(5) ) has the value `value'. No checking for sanity is performed, so beware of improper use.

 

21. SEARCHING FOR THE VISUAL HISTORY

Two new editor functions have been added: history-search-backward, bound to M-p (and M-P), and history-search-forward, bound to M-n (and M-N). Each of these search backward (or forward) through the history list for previous (next) occurrence of the first word in the input buffer as a command. That is, if the user types:

> echo foo foo > ls filea fileb > echo bar bar >

and then types "echo<ESC>p", the shell will place "echo bar" in the editing buffer. If another M-p was entered, the editing buffer would change to "echo foo". This capability is compatable with the plain visual history; if the user were to then enter ^P the editing buffer would be changed to "ls".

 

22. BUILTIN WHICH(1) COMMAND

There is now a builtin version of the which(1) command. The builtin version is just like the original, except that it correctly reports aliases peculiar to this tcsh, and builtin commands. The only other difference is that the builtin runs somewhere between 10 and 100 times faster.

 

23. RESTARTING A STOPPED EDITOR

There is another new editor function: run-fg-editor, which is bound to M-^Z. When typed, it saves away the current input buffer, and looks for a stopped job with a name equal to the file name part (last element) of either the EDITOR or VISUAL environment variables (if not defined, the default names are "ed" and "vi" respectively). If such a job is found, then it is restarted as if "fg %name" had been typed. This is used to toggle back and forth between an editor and the shell easily. Some people bind this function to ^Z so they can do this even more easily.

 

24. EXECUTION OF A COMMAND AFTER CHANGING THE CURRENT WORKING DIRECTORY

Tcsh now supports a special alias, cwdcmd, which if set holds a command that will be executed after changing the value of $cwd. For example, if the user is running on an X window system xterm, and has done

> alias cwdcmd 'echo -n "^[]0;"{$HOST}":$cwd^G"' (where the ^[ is an ESC, and the ^G is a control-G.)

then the shell will change the title of the running xterm to be the name of the host, a colon, and the full current working directory. Note that if a user defines cwdcmd to contain a cd, pushd, or popd, command, an infinite loop may result. In this case, it is the author's opinion that said user will get what he deserves.

 

25. EXECUTION OF COMMANDS ON IDLE HOSTS

Tcsh on Sprite supports automatic migration of processes for the purpose of load sharing. This is accomplished using the new special shell variable policy, which should contain a numeric value between 0 and 4. A value of 0, the default, indicates that no migration should be performed. The other values of interest are 2, which indicates that all commands should be migrated except those listed in the user's ~/.export file, or 4, which indicates that commands not in .export should be migrated when placed in the background. The export command rehashes the list of entries in .export, and export -print lists the entries. Finally, export -help lists some information about the current status of exportation.

Note that not all commands are totally location-independent, and that commands will take up idle hosts that other users might be able to use. Therefore, run commands remotely only when they are CPU-intensive. The file

/sprite/lib/tcsh/export
contains the default .export file.

 

FYI

This shell uses cbreak mode but takes typed-ahead characters anyway. You can still use stty(1) to set some of the modes of your terminal (but not bindings).

This shell will restore your tty to a sane mode if it appears to return from some command in raw, cbreak, or noecho mode.

 

ENVIRONMENT

HPATH -- path to look for command documentation
TERM -- used to tell how to handle the terminal

 

NEW SHELL VARIABLES

autologout -- number of minutes of inactivity before automatic logout
dextract -- extract a directory on pushd rather than rotating
edit -- use the input editor, set by default
fignore -- list of file name suffixes to ignore during complete
nobeep -- do not beep on non-unique expansion or excess edit
printexitvalue -- if an interactive program exits non-zero, print the exit value.
prompt -- the string to prompt with
prompt2 -- the string to prompt for while and for loops with
pushdtohome -- make pushd with no args do a "pushd ~" (like cd does)
pushdsilent -- do not print the dir stack on every pushd and popd
recexact -- recognize exact matches even if they are ambiguous
savehist -- number of history items to save between login sessions
showdots -- show hidden files in list and complete operations
term -- the terminal type; see above
tperiod -- periodic command wait period (in min.)
uid -- the current real user ID
version -- the version ID stamp for this tcsh
watch -- list of events to watch
wordchars -- list of nonalphanumeric characters considered part of a word-- defaults to "*?_-.[]~="

 

NEW SPECIAL ALIASES

periodic -- the command to be run every tperiod minutes
precmd -- the command to be run prior to printing each prompt

 

SEE ALSO

csh(1), chsh(1), termcap(5)  

BUGS

The screen update for lines longer than the screen width is very poor if the terminal cannot move the cursor up (ie. terminal type "dumb").

I am certain that there are bugs. Bugs (preferably with fixes) should be sent to Paul Placeway (paul@cis.ohio-state.edu)

 

AUTHORS

Ken Greer, HP Labs, 1981 Wrote the command completion.

Mike Ellis, Fairchild, 1983 Added command name recognition/completion.

Paul Placeway, Ohio State CIS dept., 1983 Added the command line editor.

Rayan Zachariassen, University of Toronto, 1984 Added the builtin which feature to the editor, and the code for ls-F. Also numerous bug fixes, modifications, and performance enhancements.

Chris Kingsley, Caltech. Wrote the fast storage allocator routines (nmalloc.c).

Karl Kleinpaste, CCI 1983-4 Added special aliases, directory stack extraction stuff, login/logout watch, and scheduled events. Also came up with the idea of the new prompt format.

Paul Placeway, Ohio State CIS dept., 1987 Re-wrote the editor, cleaned up other code, and added the prompt routines, added to the syntax for file name expressions, and sped up the shell some.

Chris Grevstad, TRW, 1987 Ported the 4.3 csh sources to tcsh.

Christos S. Zoulas, Cornell U. EE dept., 1987-89 ported tcsh to HPUX, and System V rel. 2 and 3 and wrote a SysV version of getwd.c

James J Dempsey, BBN, 1988, and Paul Placeway, OSU, 1988. Re-ported tcsh to A/UX

 

BUGFIXES AND ENHANCEMENTS

Hans J. Albertsson Added the ampm variable handeling

Michael Bloom Fixed some of the interupt handeling

Michael Fine, Digital Equipment Corp. added the extended key support

Daniel Long, NNSC, 1988 Added the wordchars variable

George Hartzell, MCD Biology, University of Colorado-Boulder, 1988 fixed the allways reseting to DEL bug.

Patrick Wolfe, KAI, 1988 Cleaned up VI mode and wrote the new editor discription (in section 1).

Jak Kirman, 1988 Fixed the SunOS 4 giant stack allocation bug.

Bruce Robertson, Tektronix, 1989 Fixed setting erase and kill (again).

 

THANKS TO

A special thanks to: Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig, Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky, and all the other people at Ohio State for suggestions and encouragement.

Also, thanks to all the people on the net for putting up with, reporting bugs in, and suggesting new additions to the old tcsh editor.


 

Index

NAME
SYNOPSIS
DESCRIPTION
1. COMMAND LINE EDITING
2. VISUAL HISTORY
3. TTY MODE SANITY
4. WORD COMPLETION
5. LISTING OF POSSIBLE NAMES
Command Name Recognition
6. SPELLING CORRECTION
7. DOCUMENTATION LOOKUP
8. HISTORY SAVING
9. AUTOMATIC LOGOUT
10. EXECUTION OF A COMMAND PRIOR TO EACH PROMPT
11. PERIODIC COMMAND EXECUTION
12. NEW PROMPT FORMAT
13. TIME-STAMPED HISTORY LIST
14. DIRECTORY STACK ELEMENT ACCESS
15. WATCHING FOR LOGINS AND LOGOUTS
16. TIMED EVENT LIST
17. BUILTIN FOR ls -F
18. CHAR IN RANGE SYNTAX CHANGE
19. NEW ENVIRONMENT AND SHELL VARIABLES
20. COMMANDS FOR DEBUGGING
21. SEARCHING FOR THE VISUAL HISTORY
22. BUILTIN WHICH(1) COMMAND
23. RESTARTING A STOPPED EDITOR
24. EXECUTION OF A COMMAND AFTER CHANGING THE CURRENT WORKING DIRECTORY
25. EXECUTION OF COMMANDS ON IDLE HOSTS
FYI
ENVIRONMENT
NEW SHELL VARIABLES
NEW SPECIAL ALIASES
SEE ALSO
BUGS
AUTHORS
BUGFIXES AND ENHANCEMENTS
THANKS TO

This document was created by man2html, using the manual pages.
Time: 22:49:42 GMT, December 11, 2024